package org.xlx.xlx_oa.role_user.controller;


import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.xlx.xlx_oa.common.ResponseBean;
import org.xlx.xlx_oa.role_user.api.AdmPositionApi;
import org.xlx.xlx_oa.role_user.domain.vo.AdmPositionVo;
import org.xlx.xlx_oa.role_user.service.AdmPositionService;

@RestController
@RequestMapping("/v1/adm-position")
public class AdmPositionController implements AdmPositionApi {
    @Autowired
    private AdmPositionService admPositionService;

    @PostMapping("/save")
    @Override
    public ResponseBean saveEntity(@RequestBody AdmPositionVo positionVo) {
        return ResponseBean.successFactory(admPositionService.saveEntity(positionVo));
    }

    @DeleteMapping("/remove/{id}")
    @Override
    public ResponseBean removeEntity(@PathVariable(value = "id") Long id) {
        return ResponseBean.successFactory(admPositionService.removeEntity(id));
    }

    @PostMapping("/list")
    @Override
    public ResponseBean getList(@RequestBody AdmPositionVo positionVo) {
        return ResponseBean.successFactory(admPositionService.getList(positionVo));
    }

    @PostMapping("/count")
    @Override
    public ResponseBean getCount(@RequestBody AdmPositionVo positionVo) {
        return ResponseBean.successFactory(admPositionService.getCount(positionVo));
    }

    @GetMapping("/detail/{id}")
    @Override
    public ResponseBean getDetail(@PathVariable(value = "id") Long id) {
        return ResponseBean.successFactory(admPositionService.getDetail(id));
    }
}

